#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_btnCal_clicked()
{
    CalTotal(ui->spinNum->value(), ui->spinPrice->value());
}

void Widget::on_spinNum_valueChanged(int arg1)
{
       CalTotal(arg1, ui->spinPrice->value());
}

void Widget::CalTotal(int num, double price)
{
    ui->spinTotal->setValue(num * price);
}

void Widget::on_spinPrice_valueChanged(double arg1)
{
    CalTotal(ui->spinNum->value(), arg1);
}

void Widget::on_spinDec_valueChanged(int arg1)
{
    ui->spinBin->setValue(arg1);
    ui->spinHex->setValue(arg1);
}

void Widget::on_spinBin_valueChanged(int arg1)
{
    ui->spinDec->setValue(arg1);
    ui->spinHex->setValue(arg1);
}

void Widget::on_spinHex_valueChanged(int arg1)
{
    ui->spinDec->setValue(arg1);
    ui->spinBin->setValue(arg1);
}

